Callable Statement
A CallableStatement object provides a way to call stored procedures in a standard way for all DBMSs. A stored procedure is stored in a database; the call to the stored procedure is what a CallableStatement object contains. This call is written in an escape syntax that may take one of two forms: one form with a result parameter, and the other without one. A result parameter, a kind of OUT parameter, is the return value for the stored procedure. Both forms may have a variable number of parameters used for input (IN parameters), output (OUT parameters), or both (INOUT parameters). A question mark serves as a placeholder for a parameter.

CallableStatement objects are created with the Connection method prepareCall

The syntax for invoking a stored procedure using the JDBC API is shown here.

1) {call procedure_name[(?, ?, ...)]}
2) {? = call procedure_name[(?, ?, ...)]}
3) {call procedure_name}

.

Program on Callable Statement

import java.sql.*;
public class Sample
{
public static void main(String args[])
{
Connection con=null;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:vision","scott","tiger");
CallableStatement cst=con.prepareCall(“{call renu(?)}”);
cst.setInt(1,100);
cst.executeUpdate();
cst.close();

                }
catch(ClassNotFoundException e)
{
e.printStackTrace();
}
catch(SQLException e)
{
e.printStackTrace();
}
finally
{
try
{
if(con!=null)
con.close();
}
catch(SQLException e)
{
e.printStackTrace();
}
}
}
}

            Oracle Procedure

create or replace procedure renu(n in number) is
begin
Update emp set sal=sal+1000 where eno=n;
end